package com.xxkj.nmip.utils;

/**
 * @ProjectName: coupon-saas-android
 * @Package: com.xxkj.nmip.utils
 * @ClassName: ClickUtils
 * Created by mf on 2019/6/5 17:23
 * @Description:
 */
public class ClickUtils {
    private static final int MIN_DELAY_TIME = 1000;  // 两次点击间隔不能少于1000ms
    private static long lastClickTime = 0L;

    /**
     * 是否为快速操作
     *
     * @return
     */
    public static boolean isFastClick() {
        boolean flag = false;
        long currentClickTime = System.currentTimeMillis();
        if ((currentClickTime - lastClickTime) >= MIN_DELAY_TIME) {
            flag = true;
            lastClickTime = currentClickTime;
        }
        return flag;
    }


    public static boolean isFastClick(int time) {
        boolean flag = false;
        long currentClickTime = System.currentTimeMillis();
        if ((currentClickTime - lastClickTime) >= time) {
            flag = true;
            lastClickTime = currentClickTime;
        }
        return flag;
    }

}
